package de.baumann.browser.adapter;

import android.view.View;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import de.baumann.browser.OdinGlideModule;
import de.baumann.browser.R;
import de.baumann.browser.api.net.vo.Steal;
import de.baumann.browser.utils.StringUtil;

/**
*@author:
*@date:2019/7/10 11:33
*@discription: 偷矿列表适配器
*/
@Deprecated
public class StealAdapter extends BaseQuickAdapter<Steal, BaseViewHolder> {

    public StealAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, Steal item) {
        ImageView head = helper.getView(R.id.ivStealHead);
        OdinGlideModule.loadWithCropAndCircle(mContext, item.getAvatar(), head, R.drawable.icon_head);

        if (StringUtil.isEmail(item.getUserName())){
            helper.setText(R.id.tvStealName, StringUtil.emailHide(item.getUserName()));
        }else if (StringUtil.isTel(item.getUserName())){
            helper.setText(R.id.tvStealName, StringUtil.mobileHide(item.getUserName()));
        }else {
            helper.setText(R.id.tvStealName, item.getUserName());
        }
        helper.setText(R.id.tvStealHash, mContext.getString(R.string.hash_value) +":" + item.getContribute());
        if (item.getCanState()==1) {
            helper.getView(R.id.ivStaelFlag).setVisibility(View.VISIBLE);
        } else {
            helper.getView(R.id.ivStaelFlag).setVisibility(View.GONE);
        }
    }
}
